home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / ScrollableViewEditor.cpp < prev    next >
Text File  |  1997-08-26  |  4KB  |  148 lines

  1. /*
  2.  *  File:       ScrollableViewEditor.cpp
  3.  *  Summary:       A view that knows how to edit a TScrollableView.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <->    12/07/96    JDJ        Created
  12.  */
  13.  
  14. #include "ScrollableViewEditor.h"
  15.  
  16. #include <ZControl.h>
  17. #include <ZTextBox.h>
  18.  
  19.  
  20. // ===================================================================================
  21. //    class CEditScrollableViewCommand
  22. // ===================================================================================
  23.  
  24. //---------------------------------------------------------------
  25. //
  26. // CEditScrollableViewCommand::~CEditScrollableViewCommand
  27. //
  28. //---------------------------------------------------------------
  29. CEditScrollableViewCommand::~CEditScrollableViewCommand()
  30. {
  31. }
  32.  
  33.  
  34. //---------------------------------------------------------------
  35. //
  36. // CEditScrollableViewCommand::CEditScrollableViewCommand
  37. //
  38. //---------------------------------------------------------------
  39. CEditScrollableViewCommand::CEditScrollableViewCommand(TScrollableView* pane, const SScrollableViewInfo& oldInfo, const SScrollableViewInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
  40. {
  41. }
  42.  
  43.  
  44. //---------------------------------------------------------------
  45. //
  46. // CEditScrollableViewCommand::UpdatePane
  47. //
  48. //---------------------------------------------------------------
  49. void CEditScrollableViewCommand::UpdatePane(const SScrollableViewInfo& info)
  50. {
  51.     mPane->SetScrollUnits(info.units);
  52.     mPane->SetReconcileOverhang(info.reconcileOverhang);
  53.     mPane->SetAdjustOrigin(info.adjustOrigin);
  54. }
  55.  
  56. #pragma mark -
  57.  
  58. // ===================================================================================
  59. //    CScrollableViewEditor
  60. // ===================================================================================
  61.  
  62. static TReanimatorRegister<CScrollableViewEditor> sScrollableEditorRegistrar;
  63.  
  64. //---------------------------------------------------------------
  65. //
  66. // CScrollableViewEditor::~CScrollableViewEditor
  67. //
  68. //---------------------------------------------------------------
  69. CScrollableViewEditor::~CScrollableViewEditor()
  70. {
  71. }
  72.  
  73.  
  74. //---------------------------------------------------------------
  75. //
  76. // CScrollableViewEditor::CScrollableViewEditor
  77. //
  78. //---------------------------------------------------------------
  79. CScrollableViewEditor::CScrollableViewEditor(TView* superView) : Inherited(superView)
  80. {
  81. }
  82.  
  83.  
  84. //---------------------------------------------------------------
  85. //
  86. // CScrollableViewEditor::Create                        [static]
  87. //
  88. //---------------------------------------------------------------
  89. MReanimatable* CScrollableViewEditor::Create(MReanimatable* parent)
  90. {
  91.     return new CScrollableViewEditor(dynamic_cast<TView*>(parent));
  92. }
  93.  
  94.  
  95. //---------------------------------------------------------------
  96. //
  97. // CScrollableViewEditor::GetEditorInfo        
  98. //
  99. //---------------------------------------------------------------
  100. SScrollableViewInfo CScrollableViewEditor::GetEditorInfo() const
  101. {
  102.     SScrollableViewInfo info;
  103.     
  104.     TTextBox* textBox = nil;
  105.     TControl* control = nil;
  106.         
  107.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Horz Units"));
  108.     info.units.width = textBox->GetValue();
  109.     
  110.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Vert Units"));
  111.     info.units.height = textBox->GetValue();
  112.     
  113.     control = dynamic_cast<TControl*>(this->FindSubPane("Reconcile Overhang"));
  114.     info.reconcileOverhang = control->GetValue();
  115.     
  116.     control = dynamic_cast<TControl*>(this->FindSubPane("Adjust Origin"));
  117.     info.adjustOrigin = control->GetValue();
  118.     
  119.     return info;
  120. }
  121.  
  122.  
  123. //---------------------------------------------------------------
  124. //
  125. // CScrollableViewEditor::SetEditorInfo
  126. //
  127. //---------------------------------------------------------------
  128. void CScrollableViewEditor::SetEditorInfo(const SScrollableViewInfo& info)
  129. {
  130.     TTextBox* textBox = nil;
  131.     TControl* control = nil;
  132.     
  133.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Horz Units"));
  134.     textBox->SetValue(info.units.width);
  135.     
  136.     textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Vert Units"));
  137.     textBox->SetValue(info.units.height);
  138.     
  139.     control = dynamic_cast<TControl*>(this->FindSubPane("Reconcile Overhang"));
  140.     control->SetValue(info.reconcileOverhang);
  141.     
  142.     control = dynamic_cast<TControl*>(this->FindSubPane("Adjust Origin"));
  143.     control->SetValue(info.adjustOrigin);
  144. }
  145.  
  146.  
  147.  
  148.